import React, {PureComponent} from 'react';
import {View, StyleSheet, Text} from 'react-native';
import NavigationFactory from '../utils/NavigationFactory';
import NavigationUtil from '../navigator/NavigationUtil';
import SplashScreen from 'react-native-splash-screen';
import {Colors} from 'react-native/Libraries/NewAppScreen';
@NavigationFactory
class WelcomePage extends PureComponent {
  componentDidMount(): void {
    const {navigation} = this.props;
    this.timer = setTimeout(() => {
      SplashScreen.hide();
      navigation.navigate('HomePage');
    }, 2000);
  }

  componentWillUnmount(): void {
    this.timer && clearTimeout(this.timer);
  }

  render() {
    return (
      <View style={styles.contain}>
        <Text style={styles.text}>Welcome!</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  contain: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  text: {
    fontSize: 30,
  },
});

const styles1 = StyleSheet.create({
  scrollView: {
    backgroundColor: Colors.lighter,
  },
  engine: {
    position: 'absolute',
    right: 0,
  },
  body: {
    backgroundColor: Colors.white,
  },
  sectionContainer: {
    marginTop: 32,
    paddingHorizontal: 24,
  },
  sectionTitle: {
    fontSize: 24,
    fontWeight: '600',
    color: Colors.black,
  },
  sectionDescription: {
    marginTop: 8,
    fontSize: 18,
    fontWeight: '400',
    color: Colors.dark,
  },
  highlight: {
    fontWeight: '700',
  },
  footer: {
    color: Colors.dark,
    fontSize: 12,
    fontWeight: '600',
    padding: 4,
    paddingRight: 12,
    textAlign: 'right',
  },
});


export default WelcomePage;
